<head>
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.1/jquery.js"></script>
    <!--钉钉应用监控-->
    <meta name="wpk-bid" content="dta_1_1237742538">
     <script>
        !(function(c,i,e,b){var h=i.createElement("script");
        var f=i.getElementsByTagName("script")[0];
        h.type="text/javascript";
        h.crossorigin=true;
        h.onload=function(){c[b]||(c[b]=new c.wpkReporter({bid:"dta_1_1237742538"}));
        c[b].installAll()};
        f.parentNode.insertBefore(h,f);
        h.src=e})(window,document,"https://g.alicdn.com/woodpeckerx/jssdk??wpkReporter.js","__wpk");
    </script>
    <!-- 获取授权登录码-->
    <script src="//g.alicdn.com/dingding/dingtalk-jsapi/2.6.0/dingtalk.open.js"></script>
    <script type="text/javascript">
        // 站点url
        // var siteUrl = "https://ms.gdyngl.com"
        var siteUrl = "http://192.168.18.55:8000";
        var corpId = "dinge2691072ff41c88935c2f4657eb6378f";
        var redirect_uri = siteUrl + "/autoLogin/dingTalk";
        dd.ready(function() {
            // dd.ready参数为回调函数，在环境准备就绪时触发，jsapi的调用需要保证在该回调函数触发后调用，否则无效。
            dd.runtime.permission.requestAuthCode({
                // 企业的corpId
                corpId: corpId,
                onSuccess: function(result) {
                   //成功获取后跳转到指定的URL 通过GET传一下需要的参数  result.code就是获取到的免登授权码
                   //send_to_server(result.code, "{{ next }}")
                   window.location.href = redirect_uri + "?autoCode=" + result.code

                },
                onFail : function(err) {
                    var st = JSON.stringify(err);
                    alert(st)
                }
            });
        });
    </script>
</head>

